<div id="main_content">

<h1>list of <?php echo $entity.'s'; ?></h1>

<?php 

/*if (isset($staff))
{
foreach ($staff as $row)
{
	
echo "<a href=''>". $row->FIRSTNAME."</a>          " ;
echo "<a href=''>". $row->LASTNAME."</a>          " ;       
//echo anchor("site/delete_advert/$row->id"," delete") ;
//echo anchor("site/update_advert/$row->id"," update") ;

echo"</br>";
//echo "<p>".$row->content."</p>";
}
}else{echo"sorry no employees at the moments";}*/

?>







	<div>
		 <?php echo $num_results.' '.$entity.'s'; ?> Found
	</div>
	
	<table>
		<thead>
			<?php foreach($fields as $field_name => $field_display): ?>
			<th <?php if ($sort_by == $field_name) echo "class=\"sort_$sort_order\"" ?>>
				<?php  echo anchor("employee/$field_name/" .
					(($sort_order == 'asc' && $sort_by == $field_name) ? 'desc' : 'asc') ,
					$field_display); ?>
			</th>
			<?php endforeach; ?>
		</thead>
		
		<tbody>
		<?php foreach($employees as $employee): ?>
			<tr>
				<?php foreach($fields as $field_name => $field_display): ?>
				<td>
					<?php echo $employee->$field_name; ?>
					
				</td>
				<?php endforeach; ?>
			<td>
                  <?php  echo anchor("employee/delete_employee/$employee->employeeID","delete" ); //echo $employee->employeeID;?>
                  
                  
                  </td>
            <td>  <?php echo anchor("employee/edit_employee/$employee->employeeID","Edit",'id="update"'  ); ?>
           
            </td>
            
            </tr>
			<?php endforeach; ?>			
		</tbody>
		
	</table>
	
	<?php  if (strlen($pagination)): ?>
	<div>
		Pages: <?php echo $pagination; ?>
	</div>
	<?php  endif; ?>




































<?php 

/*echo form_open('employee/add_employee');
echo form_input('firstName', 'first Name');
echo form_input('lastName', 'last Name');
echo form_input('middleName', 'middle Name');
echo form_input('workNumber', 'work Number');
echo form_input('mobileNumber', 'mobile Number');
echo form_input('homeNumber', 'home Number');
echo form_input('email', 'email');
echo form_input('DOB', 'DOB');
echo form_input('firstLineAddress', 'first Line Address');

echo form_input('secondLineAddress', 'second Line Address');
echo form_input('postcode', 'postcode');
echo form_input('city', 'city');
echo form_input('position', 'position');
echo form_input('maritalstatus', 'maritalstatus');
*/






/*data = array(
              								'firstName'=>'first name',
											'lastName'=>'last name',
											'middleName'=>'middle name',
											'workNumber'=>'workNumber',
											'mobileNumber'=>'mobileNumber',
											'homeNumber'=>'homeNumber',
											'email'=>'email',
											'sex'=>'sex',
											'dob'=>'dob',
											'firstLineAddress'=>'firstLineAddress',
											'secondLineAddress'=>'secondLineAddress',
											'postcode'=>'postcode',
											'dob'=>'dob',
											'city'=>'city',
											'country'=>'dob',
											'position'=>'position',
											'imageURL'=>'imageURL',
											'nin'=>'nin',
											'maritalstatus'=>'maritalstatus',
            								// 'placeholder' => 'my_placeholder',
            );

echo form_input($data);
*/

// echo form_submit('submit','add employee');

/*echo form_close() ;*/








?>

<p><a id="add" href="#">Add employee</a></p>





<?php  $this->load->view('add_employee_form');?>





</div>
<script type="text/javascript">
 
$(document).ready(function(){
//open popup
$("#add ").click(function(){

$("#overlay_form").fadeIn(1000);
positionPopup();

});
 
//close popup
$("#close").click(function(){
$("#overlay_form").fadeOut(500);
});
});
 
//position the popup at the center of the page
function positionPopup(){
if(!$("#overlay_form").is(':visible')){
return;
}
$("#overlay_form").css({
left: ($(window).width() - $('#overlay_form').width()) / 2,
top: ($(window).width() - $('#overlay_form').width()) / 9 ,
position:'absolute'
});
}
 
//maintain the popup at center of the page when browser resized
$(window).bind('resize',positionPopup);
 
</script>
